from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # XPATH定位
    def sou(self):
        loc=(By.XPATH,'//android.widget.TextView[@text="搜商品名称 作者 出版社 ISBN"]')
        ele=self.find_ele(loc)
        return ele

    # CLASS_NAME定位
    def shu(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele

    # ANDROID_UIAUTOMATOR定位
    def an(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.kongfz.app:id/tvSearch")')
        ele=self.find_ele(loc)
        return ele
    # ID定位
    def dian(self):
        loc=(By.ID,'com.kongfz.app:id/vShadow')
        ele=self.find_ele(loc)
        return ele
    def jia(self):
        loc=(By.ID,'com.kongfz.app:id/tvAddCart1')
        ele=self.find_ele(loc)
        return ele

    # NAME定位
    # def fan(self):
    #     loc=(By.NAME,'new UiSelector().className("android.view.View").instance(7)')
    #     ele=self.find_ele(loc)
    #     return ele
        # XPATH定位
    def duan(self):
        loc=(By.XPATH,'//android.widget.TextView[@text="鬼吹灯"]')
        ele=self.find_ele(loc)
        return ele
